﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rong.EasyExcel.Attributes;

namespace Simple.Services
{
    [HeaderStyle(ColumnAutoSize = true)] // 自动列宽
    public class ExportChildrenModel : ModelBase
    {
        /// <summary>
        /// 幼儿姓名
        /// </summary>
        [Display(Name = "幼儿姓名")]
        public string Name { get; set; } = "";

        /// <summary>
        /// 学号
        /// </summary>
        [Display(Name = "学号")]
        public string? StudentNumber { get; set; }

        /// <summary>
        /// 出生日期
        /// </summary>
        [Display(Name = "出生日期")]
        public string? BirthdayStr { get; set; }

        /// <summary>
        /// 所在班级
        /// </summary>
        [Display(Name = "所在班级")] 
        public string? ClassName { get; set; }

        /// <summary>
        /// 登记日期
        /// </summary>
        [Display(Name = "登记日期")]
        public DateTime? RegisteredDay { get; set; }

        /// <summary>
        /// 所在班级
        /// </summary>
        [IgnoreColumn]
        public string? ClassesId { get; set; }

        public override void ConfigureMapper(Profile profile)
        {
            profile.CreateMap<Childrens, ExportChildrenModel>()
                .ForMember(dest => dest.BirthdayStr, option => option.MapFrom(b => b.Birthday.Value.ToString("yyyy-MM-dd")));
            profile.CreateMap<ExportChildrenModel, Childrens>();

        }
    }
}
